package com.scrx.ymg.dao.orderform;

import java.util.List;
import java.util.Map;

import com.scrx.ymg.entity.AgentMoney;
import com.scrx.ymg.entity.DirectProduct;
import com.scrx.ymg.entity.HeadMoney;
import com.scrx.ymg.entity.OrderForm;
import com.scrx.ymg.entity.OrderFormDetails;
import com.scrx.ymg.entity.OrderReturn;
import com.scrx.ymg.entity.OtherMoney;
import com.scrx.ymg.entity.ProductEvaluate;
import com.scrx.ymg.entity.SeckillProduct;
import com.scrx.ymg.entity.SuperMarketEntrepot;
import com.scrx.ymg.entity.SupermarketMoney;
import com.scrx.ymg.entity.User;
import com.scrx.ymg.entity.UserComplain;

public interface IOrderFormDao {
	
	
    
	/**
	 * 数据库持久化订单头
	 * @param transientInstance 订单对象
	 */
	public void save(OrderForm transientInstance);
	
	/**
	 * 数据库更新订单头
	 * @param transientInstance 订单对象
	 */
	public String update(OrderForm transientInstance);
	
	/**
	 *  保存订单及订单详情
	 * @param order
	 * @param details
	 */
	public String saveOrderFormAndDetails(User user,OrderForm order,List<OrderFormDetails> details,List<SuperMarketEntrepot> superEns);
	
	/**
	 * 根据userID,状态分组,查询订单头数量
	 * @return
	 */
	public List<OrderForm> getOrderFormGroupStatus(String userID);
	
	/**
	 * 根据用户查询对应状态的订单详情
	 * @param userid 用户id
	 * @param status 订单状态
	 * @return json 对应订单
	 */
	public List getOrderFormByStatus(String userid,String status);
	
	/**
	 * 根据用户查询对应状态的订单详情
	 * @param userid 用户id
	 * @return json 对应订单
	 */
	public List getOrderFormByUserID(String userid);
	
	
	/**
	 * 根据订单头ID得到订单头信息
	 * @param orderFormID
	 * @return
	 */
	public OrderForm getOrderFormByOrderFormID(String orderFormID);
	
	/**
	 * 根据订单头ID得到订单头信息
	 * @param orderFormID
	 * @return
	 */
	public OrderForm getOrderFormByID(int ID);
    
	/**
	 * 用户确认收货
	 * @param order
	 * @param money
	 * @return
	 */
	public String takeDeliveryOfGoods(OrderForm order, SupermarketMoney money,User user);
    
	/**
	 * 根据超市id查询所属状态订单
	 * @param superID 用户ID
	 * @param status 订单状态
	 * @return json 对应订单
	 */
	public List<OrderForm> getOrderFormBySuperID(String userID, String status);
    
	/**
	 * 根据超市查询订单
	 * @return
	 */
	public Map<Object, Object> getOrderFormBySuper(OrderForm orderform,String startTime,String endTime,int pageNum,int pageCount);
    
	/**
	 * 根据超市查询订单
	 * @return
	 */
	public Map<Object, Object> getOrderFormBySuper(OrderForm orderform,int pageNum,int pageCount);
	
	
	/**
	 * 根据订单商品得到超市商品
	 * @param details 订单下详情
	 * @return
	 */
	public List<SuperMarketEntrepot> getSuperMarketEntrepotes(List<OrderFormDetails> details);
	
	
	/**
	 * 更新订单信息并生成投诉表单
	 * @param order
	 * @param com
	 * @return
	 */
	public String complaintOrderForm(OrderForm order,UserComplain com);
    /**
     * 更新订单信息并生成评价表单
     * @param order
     * @param peva
     * @return
     */
	public String evaluateOrderForm(OrderForm order,List<ProductEvaluate> pevalist);
    /**
     * 得到超市配送电话
     * @param superID
     * @return
     */
	public String getSendPhone(int superID);
    
	/**
	 * 根据条件查询用户退货信息
	 * @param order
	 * @return
	 */
	public Map<Object, Object> getUserReturn(OrderReturn order,int pageCount,int pageNum);
	
	/**
	 * 根据orderid得到退货信息
	 * @param orderFormId
	 * @return
	 */
	public OrderReturn getOrderReturnByorderID(String orderFormId);
	
    /**
     * 更新订单和退货信息
     * @param order
     * @param oreturn
     * @return
     */
	public String setOrderFormAndOrderReturn(OrderForm order,Object headMoney,List<SuperMarketEntrepot> entrlist);
     
	/**
     * 根据订单id查询订单详情
     * @param orderFormId
     * @return
     */
	public List<OrderFormDetails> getOrderFormDetailsByOrderFormID(String orderFormId);
	
	
    
	/**
	 * 更新订单和各商家金额
	 * @param oldorder
	 * @param otherMoney
	 * @param superMoney
	 * @param agentMoney
	 * @param headMoney
	 * @return
	 */
	public String updateObjects(OrderForm oldorder, Object otherMoney, SupermarketMoney superMoney,
			AgentMoney agentMoney, HeadMoney headMoney);
    
	/**
	 * 更新订单和平台收入
	 * @param order
	 * @param headMoney
	 * @return
	 */
	public String updateOrderFormAndHeadMoney(OrderForm order, HeadMoney headMoney,SeckillProduct product);
	
	/**
	 * 更新订单和平台收入
	 * @param order
	 * @param headMoney
	 * @return
	 */
	public String updateOrderFormAndHeadMoney(OrderForm order, HeadMoney headMoney);
    
	/**
	 * 更新广告订单和代理商总部平台收入
	 * @param oldproduct
	 * @param agentMoney
	 * @param headMoney
	 * @return
	 */
	public String updateByAd(SeckillProduct oldproduct, AgentMoney agentMoney, HeadMoney headMoney);
    
	
	/**
	 * 更新订单并还原库存
	 * @param order
	 * @param entrlist
	 * @return
	 */
	public String update(OrderForm order, List<SuperMarketEntrepot> entrlist);
	
	/**
	 * 查询订单
	 * @param order
	 * @return
	 */
	public List<OrderForm> getOrderFormList(OrderForm order);
    
	/**
	 * 保存订单集合
	 * @param list
	 */
	public void saveOrderFormList(List<OrderForm> list);
	
	/**
	 * 更具直营订单详情得到直营商品集合
	 * @param details
	 * @return
	 */
	public List<DirectProduct> getDirectProductByOrderFormDetails(List<OrderFormDetails> details);
    
	/**
	 * 保存直营订单
	 * @param user
	 * @param payorder
	 * @param orderlist
	 * @param products
	 * @return
	 */
	public String saveOrderFormListAndDetails(User user, OrderForm payorder, List<OrderForm> orderlist,
			List<DirectProduct> products);
    
	/**
	 * 查询直营订单集合
	 * @param id
	 * @return
	 */
	public List<OrderForm> getOrderFormListByPreant(Integer id);
    
	/**
	 * 更新直营支付订单,直营订单.和平台收入
	 * @param order
	 * @param headMoney
	 * @param list
	 * @return
	 */
	public String updateOrderFormAndHeadMoney(OrderForm order, HeadMoney headMoney, List<OrderForm> list);
    
	/**
	 * 更新订单并发送消息
	 * @param order
	 * @param list
	 * @return
	 */
	public String updateOrderFormSendMessage(OrderForm order, List<OrderForm> list);
    
	/**
	 * 保存购物订单
	 * @param user
	 * @param order
	 * @param products
	 * @return
	 */
	public String insertPurchaseOrder(User user, OrderForm order, List<DirectProduct> products);
	
	


}
